package com.bw.controller;

import com.bw.entity.TbRule;
import com.bw.service.RuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class RuleController {
    @Autowired
    private RuleService ruleService;

    //接口规则列表
    @RequestMapping("rulelist")
    public List<TbRule> rulelist(@RequestParam("mohu")String mohu){
        List<TbRule> rulelist=ruleService.rulelist(mohu);

        return rulelist;
    }

    @RequestMapping("tingyong")
    public void tingyong(@RequestParam("id") String id){
        String[] ids = id.split(",");
        for (String aa:
                ids ) {
            System.out.println(id+"===========");
            ruleService.tingyong(aa);
        }
    }

    @RequestMapping("qiyong")
    public void qiyong(@RequestParam("id") String id){
        String[] ids = id.split(",");
        for (String aa:
                ids ) {
            System.out.println(id+"===========");
            ruleService.qiyong(aa);
        }
    }
}
